package com.lagou.edu.mvcframework.pojo;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

public class Handler {

    //controller对象
    private Object controller;

    //url映射的method方法
    private Method method;

    //映射的url
    private Pattern pattern;

    //有权限访问的用户名集合
    private Set<String> userNames;

    public Set<String> getUserNames() {
        return userNames;
    }

    public void setUserNames(Set<String> userNames) {
        this.userNames = userNames;
    }

    //参数与参数顺序映射，方便进行参数绑定，key为参数名，value为数组中索引
    private Map<String,Integer> parameterMap;

    public Handler(Object controller, Method method, Pattern pattern,Set<String> userNames) {
        this.controller = controller;
        this.method = method;
        this.pattern = pattern;
        this.parameterMap = new HashMap<>();
        this.userNames = userNames;
    }

    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }

    public Map<String, Integer> getParameterMap() {
        return parameterMap;
    }

    public void setParameterMap(Map<String, Integer> parameterMap) {
        this.parameterMap = parameterMap;
    }
}
